The present invention relates to processing units for computer systems, and in particular to a processing unit capable of coordinating the execution of multiple tasks having varying degrees of priority. Such processing units typically include a high-priority task, a low-priority task that is always executable, and numerous additional tasks having priorities at varying levels between the high-priority and low-priority tasks. Each of these tasks is executable by the processing unit, but only one task may be executed at any given point in time. Accordingly, the processing unit must coordinate the execution of these tasks to ensure all such tasks are executed in timely fashion.
To this end, each task executable by the processing unit is assigned a request condition and a terminating condition. The processing unit identifies a set of all tasks for which the request condition is satisfied and the terminating condition is not satisfied, and then initiates execution of the task in that set having the highest priority. Execution continues until the termination condition for the executing task is satisfied, at which time the processing unit initiates execution of the task in the set having the next highest priority.
Processing units of the type to which the present invention is directed are well known in the art, often being used as central processing units for modular programmable controllers. In such central processing units, execution of the highest-priority task continues until either its terminating condition is satisfied or the processing unit detects the satisfaction of the request condition for a task having a higher priority, at which time execution of the first task is superseded by the higher priority task. This type of task control is undesirable because the resources of the processing unit can be monopolized by the highest priority task, to the exclusion of all tasks having lower priorities.
Another known approach to multi-tasking in a processing unit involves assigning "time slices" to each task for which the request condition is satisfied, so that each task is executed periodically during its allocated time slice. In such systems, the only way to effect the priority of tasks is by assigning more time slices to a high-priority task than to a low-priority task. However, this approach has the drawback of not being able to immediately respond to requests for high-priority tasks.
One such "time slicing" processing unit is described in the "IBM Technical Bulletin," Vol. 19, No. 11, April 1977, at 4354-56. In that processing unit, each task is assigned a priority and typically the task having the highest priority is executed. However, a compulsory switch to another task is made after a predefined maximum time period elapses. This maximum time period is identical for all tasks.
A similar processing unit is described in U.S. Pat. No. 4,145,735, with the additional feature that the predefined maximum time period is "customized" to each task according to the task's priority. The highest-priority task is assigned the smallest maximum time period, while the lowest-priority task is assigned the largest maximum time period. In addition, a task can no longer be invoked once its maximum time period has elapsed.
Even systems using the time-slicing approach can become "locked-up" due to a system error. Thus, an object of the present invention is to provide a processing unit offering improved coordination over multiple executable tasks having varying levels of priority, while avoiding the types of "lock-ups" to which known systems are prone. This object is achieved by providing a processing unit which reacts quickly to high-priority tasks, yet ensures the high-priority tasks do not monopolize the resources of the processing unit.